Code
create a data frame
# Create a simple data frame
students <- data.frame(
Name = c("Arun", "Arun", "Charan", "Divya", "Eswar",
"Fathima", "Gopal", "Harini", "Ilango", "Jayanthi"),
Age = c(25, 25, 35, 28, 22, 40, 33, 27, 31, 29),
Height = c(5.6, 5.6, NA, 5.4, 6.0, 5.3, 5.9, 5.5, 5.7, 5.8),
Gender = c("M", "M", NA, "F", "M", "F", "M", "F", "M", "F"),
Marks = c(85, 85, 78, 88, 76, 95, 82, 89, 80, 91),
Attendance = c(92, 92, 88, 90, 87, 95, 83, 89, 86, 91)
)
head(students)
Name Age Height Gender Marks Attendance
1 Arun 25 5.6 M 85 92
2 Arun 25 5.6 M 85 92
3 Charan 35 NA <NA> 78 88
4 Divya 28 5.4 F 88 90
5 Eswar 22 6.0 M 76 87
6 Fathima 40 5.3 F 95 95